package com.leetcode;

import java.util.ArrayList;
import java.util.List;

public class No225 {
    class MyStack {

        List<Integer> list = new ArrayList<>();
        int count = 0;

        public MyStack() {

        }

        public void push(int x) {
            list.addLast(x);
            count++;
        }

        public int pop() {
            int res = list.get(count - 1);
            list.remove(count - 1);
            count--;
            return res;
        }

        public int top() {
            return list.get(count - 1);
        }

        public boolean empty() {
            return count == 0;
        }
    }
}
